<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <style>
        .login-form {
            max-width: 400px;
            margin: 50px auto;
        }

        .login-form img {
            max-width: 100%;
            height: auto;
            margin-bottom: 20px;
        }

        .login-form .form-group {
            margin-bottom: 20px;
        }

        .login-form .captcha {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .login-form .captcha img {
            margin-right: 10px;
        }

        .register-link {
            text-align: center;
        }
    </style>
    <title>注册</title>
</head>
<body>

<div class="container login-form">
    <h2 class="text-center">用户注册</h2>
    <form id="registerForm">
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" class="form-control" name="username" id="username" placeholder="输入用户名" required>
        </div>
        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" class="form-control" name="password" id="password" placeholder="输入密码" required>
        </div>

        <div class="form-group">
            <label for="tel">电话</label>
            <input type="text" class="form-control" name="tel" id="tel" placeholder="输入电话" required>
        </div>

        <div class="form-group">
            <label for="gender">性别</label>
            <select name="gender" class="form-control" id="gender">
                <option value="男">男</option>
                <option value="女">女</option>
            </select>
        </div>

        <div class="form-group">
            <label for="address">地址</label>
            <input type="text" class="form-control" name="address" id="address" placeholder="输入地址" required>
        </div>

        <button type="button" id="registerButton" class="btn btn-primary btn-block">注册</button>
    </form>
    <div class="register-link">
        <p>已有账号？<a href="login.html">登录</a></p>
    </div>
</div>

<script src="/js/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        $("#registerButton").click(function () {
            var formData = $("#registerForm").serialize();
            $.ajax({
                type: "POST",
                url: "/register",
                data: formData,
                success: function (response) {
                    alert(response)
                },
                error: function (error) {
                    console.log("Error:", error);
                }
            });
        });

    });
</script>


</body>
</html>
